﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _15 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "IpArea",
                table: "SysLogOperating",
                type: "varchar(100)",
                maxLength: 100,
                nullable: true,
                comment: "IP所在地区")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "SysLoginLogs",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    LoginSource = table.Column<int>(type: "int", nullable: true, comment: "登录来源"),
                    LoginType = table.Column<int>(type: "int", nullable: true, comment: "登录类型"),
                    Account = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true, comment: "操作人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Browser = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true, comment: "浏览器")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperatingSystem = table.Column<string>(type: "longtext", nullable: true, comment: "操作系统")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Ip = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: true, comment: "IP")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IpArea = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "IP所在地区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsSuccess = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否执行成功"),
                    Result = table.Column<string>(type: "longtext", nullable: true, comment: "返回结果")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ElapsedTime = table.Column<long>(type: "bigint", nullable: true, comment: "耗时（毫秒）"),
                    OperatingTime = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false, comment: "操作时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SysLoginLogs", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SysLoginLogs");

            migrationBuilder.DropColumn(
                name: "IpArea",
                table: "SysLogOperating");
        }
    }
}
